package com.etc.service.impl;

import java.util.List;

import com.etc.dao.IEmployeesDao;
import com.etc.dao.impl.EmployeesDaoImpl;
import com.etc.entity.Employees;
import com.etc.service.IEmployeesService;
import com.etc.util.MD5Util;
import com.etc.util.PageData;

public class EmployeesServiceImpl implements IEmployeesService {
	IEmployeesDao dao=new EmployeesDaoImpl();
	
	//根据id查员工
	@Override
	public Employees queryById(int empId) {
		return dao.queryById(empId);
	}
	
	//查询所有员工
	@Override
	public List<Employees> getAllEmployees() {
		return dao.queryAllEmployees();
	}

	//登录
	@Override
	public Employees login(String empname, String emppwd) {
		emppwd = MD5Util.doubleEncryption(emppwd);
		return dao.queryEmpByNameAndPwd(empname, emppwd);
	}
	//查询员工分页显示
	@Override
	public PageData getqueryAllEmployeesd(int pageNo, int pageSize) {
		// TODO Auto-generated method stub
	
		return dao.queryAllEmployeesd(pageNo, pageSize);
	}

	/**
	 * 添加员工信息
	 * employees:员工对象
	 * deptId:部门id
	 * return:boolean值
	 */
	@Override
	public boolean addEmployees(Employees employees,int deptId) {
		// TODO Auto-generated method stub
		return dao.addEmployees(employees,deptId);
	}

	/**
	 * 修改员工信息
	 * employees:员工对象
	 * deptId:部门id
	 * return:boolean值
	 */
	@Override
	public boolean modifyEmployees(Employees employees, int deptId) {
		// TODO Auto-generated method stub
		return dao.modifyEmployees(employees, deptId);
	}

	/**
	 * 删除员工(修改状态)
	 * empId:员工id
	 * return:boolean值
	 */
	@Override
	public boolean delsEmployees(int empId) {
		// TODO Auto-generated method stub
		return dao.delsEmployees(empId);
	}

	/**
	 * 分页显示员工
	 */
	@Override
	public PageData queryKeyEmployeesd(int pageNo, int pageSize, int empId1, String empName1, int deptId1,
			int empStatus1, String hireDate1, String hireDate2) {
		// TODO Auto-generated method stub
		return dao.queryKeyEmployeesd(pageNo, pageSize, empId1, empName1, deptId1, empStatus1, hireDate1, hireDate2);
	}

	@Override
	public boolean modifyEmpPic(Employees employees) {
		return dao.modifyEmpPic(employees);
	}
}
